package com.caozf.singleton.lazy;

/**
 * 创建时间：2019/9/13 8:15
 * 创建人:曹子方
 */
public class LazyInnerClassSingleton {
    private LazyInnerClassSingleton(){
        if(LazyHolder.LAZY!=null){
            throw new RuntimeException("不允许创建多个实例，请使用getInstance获得实例");
        }
    }
    public static LazyInnerClassSingleton getInstance(){
        return LazyHolder.LAZY;
    }
    private static class LazyHolder{
        private static final LazyInnerClassSingleton LAZY=new LazyInnerClassSingleton();
    }
}
